/**
 * Created with CLion.
 * Description: 
 * User: loong
 * Date: 2019-12-26
 * Time: 11:29
 */
#include "InitMainWindow.h"


InitMainWindow::InitMainWindow(QMainWindow *parent):
    QMainWindow(parent){
    this->resize(400,600);
    this->move(0,0);
    this->setWindowTitle("植物查询系统");

    loginWidget = new LoginWidget(this);

    mainForm = new MainForm(this);
    mainForm->hide();

    //显示主界面
    connect(loginWidget,SIGNAL(goMainForm()),this,SLOT(showMainForm()));
    //退出主界面，返回到登录界面
    connect(mainForm,SIGNAL(backInitWimdow()),this,SLOT(showInitWidget()));
}

void InitMainWindow::Init() {


}

void InitMainWindow::paintEvent(QPaintEvent *event) {
    QPainter painter(this);
    QPixmap pic("../res/pic/01.jpg");
    //透明度设置
    painter.setOpacity(0.4);
    //根据指定图片绘制
    painter.drawPixmap(0, 0, width(), height(), pic);
}

InitMainWindow::~InitMainWindow() {
    delete loginWidget;
    delete mainForm;
}

void InitMainWindow::showMainForm() {
    //qDebug()<<"sss";
    loginWidget->hide();
    mainForm->show();
}

void InitMainWindow::showInitWidget() {
    mainForm->hide();
    loginWidget->show();
}


